package quanlydoanra.func03;

import java.util.ArrayList;
import javax.faces.model.SelectItem;

/******************************************
 * Filename			: F03KeySearch.java
 * Description		: 
 * Created date		: Jul 20, 2008
 * Author			: Phonglt
 ******************************************/
public class F03KeySearch {
	
	private ArrayList<F03SearchInfo> listItem = new ArrayList<F03SearchInfo>();
	private static final String frm_default = "/qldoanra/func03/frmdefault.xhtml";
	private static final String frm_period = "/qldoanra/func03/frmperiod.xhtml";
	private static final String frm_date = "/qldoanra/func03/frmdate.xhtml";
	
	public F03KeySearch() {
		this.listItem.add(new F03SearchInfo("loaidoan", "Tên Đoàn", 1));
		this.listItem.add(new F03SearchInfo("nuocDen", "Tên nước đến", 1));
		this.listItem.add(new F03SearchInfo("ngaydi", "Ngày đi", 2));
		this.listItem.add(new F03SearchInfo("ngayve", "Ngày về", 2));
		this.listItem.add(new F03SearchInfo("donViMoi", "Đơn vị mời", 1));
		this.listItem.add(new F03SearchInfo("linhVuc", "Lĩnh vực", 1));
		this.listItem.add(new F03SearchInfo("mucDich", "Mục đích", 1));
		this.listItem.add(new F03SearchInfo("chiPhi", "Chi phí", 1));
		this.listItem.add(new F03SearchInfo("soqd", "Số quyết định", 1));
		this.listItem.add(new F03SearchInfo("nguoikyqd", "Người ký Quyết định", 1));
		this.listItem.add(new F03SearchInfo("ngayquydinhnop", "Ngày nộp báo cáo", 2));
		this.listItem.add(new F03SearchInfo("baocaokq", "Báo cáo kết quả", 1));
		this.listItem.add(new F03SearchInfo("nguoiTrongDoan", "Người trong Đoàn", 1));
		this.listItem.add(new F03SearchInfo("period", "Báo cáo giai đoạn", 3));
	}

	/**************************************
	 * Method name		: getKeySearchItem
	 * Return type		: SelectItem[]
	 * Description		: lay danh sach cac item search
	 * Created date		: Jul 20, 2008
	 * Author			: Phonglt
	 **************************************/
	public SelectItem[] getKeySearchItem() {
		SelectItem[] list = new SelectItem[listItem.size()];
		for (int i = 0; i < list.length; i++) {
			list[i] = new SelectItem(i, this.listItem.get(i).getLabel());
		}
		return list;
	}
	
	/**************************************
	 * Method name		: getFieldSearch
	 * Return type		: String
	 * Description		: lay ra truong de truy xuat CSDL tu key search
	 * Created date		: Jul 20, 2008
	 * Author			: Phonglt
	 **************************************/
	public String getFieldSearch(int key){
		return this.listItem.get(key).getField();
	}
	
	/**************************************
	 * Method name		: getSrcForm
	 * Return type		: String
	 * Description		: lay dia chi file nguon cua form tuong ung key search
	 * Created date		: Jul 20, 2008
	 * Author			: Phonglt
	 **************************************/
	public String getSrcForm(int key){
		switch (this.listItem.get(key).getType()) {
		case 1:
			return frm_default;
			
		case 2:
			return frm_date;
			
		case 3:
			return frm_period;
			
		default: return frm_default;
		}
	}

	public int getTypeSearch(int key) {
		return this.listItem.get(key).getType();
	}
}
